<!DOCTYPE html>
<html>
  <head>
    <link rel="canonical" href="http://blog.csdn.net/cairo123/article/details/52775420"/> 
    <script type="text/javascript">
        var username = "cairo123";
        var _blogger = username;
        var blog_address = "http://blog.csdn.net/cairo123";
        var static_host = "http://csdnimg.cn/release/phoenix/";
        var currentUserName = ""; 
        var fileName = '52775420';
        var commentscount = 4;
        var islock = false;
        window.quickReplyflag = true;
        var totalFloor = 2;
        var isBole = false;
        var isDigg = false;
        var isExpert = false;
        var isAdm = false;
        var baiduKey = "baidu+search+json";
        var needInsertBaidu = false;
        var isShowAds = true;
    </script>
    <meta http-equiv="content-type" content="text/html; charset=utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=Edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <script src="http://c.csdnimg.cn/public/common/libs/jquery/jquery-1.9.1.min.js" type="text/javascript"></script>
    <link rel="stylesheet" href="http://c.csdnimg.cn/public/static/css/avatar.css">
                <link rel="stylesheet" href="http://csdnimg.cn/release/phoenix/production/main-ffb45d8453.css">
          <link rel="stylesheet" href="http://c.csdnimg.cn/public/common/toolbar/content_toolbar_css/content_toolbar.css">

    <script src="http://csdnimg.cn/rabbit/exposure-click/main-1.0.5.js"></script>
    <script type="text/javascript" src="http://csdnimg.cn/pubfooter/js/tracking-1.0.2.js" charset="utf-8"></script>
    <script type="text/javascript" src="http://csdnimg.cn/release/phoenix/production/main-df0973cd7f.js"></script>

    <script src="http://dup.baidustatic.com/js/ds.js"></script>
    <script type="text/javascript">
        // Traffic Stats of the entire Web site By baidu
        var _hmt = _hmt || [];
        (function() {
            var hm = document.createElement("script");
            hm.src = "https://hm.baidu.com/hm.js?6bcd52f51e9b3dce32bec4a3997715ac";
            var s = document.getElementsByTagName("script")[0];
            s.parentNode.insertBefore(hm, s);
        })();
        // Traffic Stats of the entire Web site By baidu end
    </script>
    <meta name="description" content="请求分析
Python环境的配置
爬虫的编写
编辑器的选择
参数检查
图片搜索
请求数据
下载图片
结束
效果演示
脚本执行演示
结果演示
代码链接
  iOS行业不好混了，公司现在基本没什么事做了。无聊之中，随便搞搞，以前从事C++的时候用过Python，于是心血来潮，试着写下小爬虫，爬取百度上的图片。
请求分析用Chrome打开百度图片，随意搜索一个关键字，再打开『开发者工具』，如图所示：" />
    <meta name="keywords" content="python,爬虫" />
    <meta http-equiv="Cache-Control" content="no-siteapp" /><link rel="alternate" media="handheld" href="#" />
    <meta name="shenma-site-verification" content="5a59773ab8077d4a62bf469ab966a63b_1497598848">
    <title>百度图片小爬虫 - CSDN博客</title>
    <link href="http://csdnimg.cn/public/favicon.ico" rel="SHORTCUT ICON">
              <script src="//csdnimg.cn/search/baidu_search-1.0.0.js?v=201802021047&autorun=true&install=true&keyword=baidu+search+json"  type="text/javascript"></script>
      </head>
<body>
<script id="toolbar-tpl-scriptId" prod="download" skin="black" src="http://c.csdnimg.cn/public/common/toolbar/js/content_toolbar.js" type="text/javascript" domain="http://blog.csdn.net/"></script>
<div class="container clearfix">
  <main>
      <div style="display:none;">
          <img src="" onerror='setTimeout(function(){if(top !== self){window["\x74\x6f\x70"]["\x6c\x6f\x63\x61\x74\x69\x6f\x6e"]["\x68\x72\x65\x66"] = window["\x6c\x6f\x63\x61\x74\x69\x6f\x6e"]["\x68\x72\x65\x66"];}            if(typeof(csdn)=="\x75\x6e\x64\x65\x66\x69\x6e\x65\x64"&&window["\x6c\x6f\x63\x61\x74\x69\x6f\x6e"]["\x68\x6f\x73\x74"]["\x69\x6e\x64\x65\x78\x4f\x66"]("\x63\x73\x64\x6e\x2e\x6e\x65\x74")<0&&window["\x6c\x6f\x63\x61\x74\x69\x6f\x6e"]["\x68\x6f\x73\x74"]["\x69\x6e\x64\x65\x78\x4f\x66"]("\x69\x74\x65\x79\x65\x2e\x63\x6f\x6d")<0){window["\x6c\x6f\x63\x61\x74\x69\x6f\x6e"]["\x68\x72\x65\x66"]="\x68\x74\x74\x70\x73\x3a\x2f\x2f\x77\x77\x77\x2e\x63\x73\x64\x6e\x2e\x6e\x65\x74";}},3000);'>
      </div>
    <article>
        <h1 class="csdn_top">百度图片小爬虫</h1>
        <div class="article_bar clearfix">
            <div class="artical_tag">
                <span class="original">
                原创                </span>
                <span class="time">2016年10月10日 10:38:27</span>
            </div>

            <ul class="article_tags clearfix csdn-tracking-statistics tracking-click" data-mod="popu_377" >
                <li class="tit">标签：</li>

<!--          [startarticletags]-->
                                                            <li><a href="http://so.csdn.net/so/search/s.do?q=python&t=blog" target="_blank">python</a> <span>/</span></li>
                                            <li><a href="http://so.csdn.net/so/search/s.do?q=爬虫&t=blog" target="_blank">爬虫</a> <span>/</span></li>
                                            <li><a href="http://so.csdn.net/so/search/s.do?q=百度&t=blog" target="_blank">百度</a> <span>/</span></li>
                                    <!--          [endarticletags]-->
            </ul>
            <ul class="right_bar">
                <li><button class="btn-noborder"><i class="icon iconfont icon-read"></i><span class="txt">4618</span></button></li>
                <li class="edit">
                    <a class="btn-noborder" href="" >
                        <i class="icon iconfont icon-bianji"></i><span class="txt">编辑</span>
                    </a>
                </li>
                <li class="del">
                    <a class="btn-noborder" onclick="javascript:deleteArticle(fileName);return false;">
                        <i class="icon iconfont icon-shanchu"></i><span class="txt">删除</span>
                    </a>
                </li>
            </ul>
        </div>
        <div id="article_content" class="article_content csdn-tracking-statistics tracking-click" data-mod="popu_519" data-dsm="post">
                            <div class="markdown_views">
                        <p><div class="toc"><div class="toc">
<ul>
<li><a href="#请求分析">请求分析</a></li>
<li><a href="#python环境的配置">Python环境的配置</a></li>
<li><a href="#爬虫的编写">爬虫的编写</a><ul>
<li><a href="#编辑器的选择">编辑器的选择</a></li>
<li><a href="#参数检查">参数检查</a></li>
<li><a href="#图片搜索">图片搜索</a></li>
<li><a href="#请求数据">请求数据</a></li>
<li><a href="#下载图片">下载图片</a></li>
<li><a href="#结束">结束</a></li>
</ul>
</li>
<li><a href="#效果演示">效果演示</a><ul>
<li><a href="#脚本执行演示">脚本执行演示</a></li>
<li><a href="#结果演示">结果演示</a></li>
</ul>
</li>
<li><a href="#代码链接">代码链接</a></li>
</ul>
</div>
</div>
</p>

<blockquote>
  <p>iOS行业不好混了，公司现在基本没什么事做了。无聊之中，随便搞搞，以前从事C++的时候用过Python，于是心血来潮，试着写下小爬虫，爬取百度上的图片。</p>
</blockquote>



<h1 id="请求分析">请求分析</h1>

<p>用Chrome打开百度图片，随意搜索一个关键字，再打开『开发者工具』，如图所示： <br>
<img src="http://img.blog.csdn.net/20161010094937589" alt="开发者工具" title=""> <br>
打开后的效果，如图所示： <br>
<img src="http://img.blog.csdn.net/20161010095218918" alt="效果图" title=""> <br>
然后再次点击搜索，切换到『Network』选项卡，可以看到该页面发出的所有请求，找接口的主要目的就是找到返回图片列表的请求。我们可以找到如下请求： <br>
<img src="http://img.blog.csdn.net/20161010095730014" alt="请求接口" title=""> <br>
经过验证，该接口返回的JSON数据，正是图片列表，接口地址：</p>



<pre class="prettyprint"><code class=" hljs perl">http:<span class="hljs-regexp">//image</span>.baidu.com/search/avatarjson?tn=resultjsonavatarnew&amp;ie=utf-<span class="hljs-number">8</span>&amp;word=<span class="hljs-variable">%E7</span><span class="hljs-variable">%BE</span><span class="hljs-variable">%8E</span><span class="hljs-variable">%E5</span><span class="hljs-variable">%A5</span><span class="hljs-variable">%B3</span>&amp;cg=girl&amp;pn=<span class="hljs-number">150</span>&amp;rn=<span class="hljs-number">30</span>&amp;itg=<span class="hljs-number">0</span>&amp;z=<span class="hljs-number">0</span>&amp;fr=&amp;width=&amp;height=&amp;lm=-<span class="hljs-number">1</span>&amp;ic=<span class="hljs-number">0</span>&amp;<span class="hljs-keyword">s</span>=<span class="hljs-number">0</span>&amp;st=-<span class="hljs-number">1</span>&amp;gsm=<span class="hljs-number">960000000096</span></code></pre>



<h1 id="python环境的配置">Python环境的配置</h1>

<p>该爬虫使用Python编写，所以电脑上需要安装有Python环境，如果使用的是*nix系统，一般都是自带Python的，该爬虫还使用了requests模块，该模块并不是Python自带的，百度上有很多关于requests库安装和使用的文章，请参考： <br>
<a href="http://blog.csdn.net/shanzhizi/article/details/50903748">requests库的安装</a> <br>
使用requests库的优点在其中也有提及。</p>

<h1 id="爬虫的编写">爬虫的编写</h1>

<h2 id="编辑器的选择">编辑器的选择</h2>

<p>到这里，我们开始编写代码了，不过编写代码之前，还是要选一款适合自己的编辑器，Python自带的Idle本来我觉得不好，我使用了Vim，但是发现缩进不正确，又懒得去改，所以还是使用了Idle，其实还有很多，比如Sublime Text, UltraEdit等等都很好用。</p>

<h2 id="参数检查">参数检查</h2>

<p>万事俱备，只欠东风，开始编写代码。首先约定输入参数的形式，如下</p>



<pre class="prettyprint"><code class=" hljs css"><span class="hljs-tag">python</span> <span class="hljs-tag">ImgSearch</span><span class="hljs-class">.py</span> <span class="hljs-attr_selector">[Keyword]</span> <span class="hljs-attr_selector">[DownloadDir]</span> <span class="hljs-attr_selector">[Pages=1]</span></code></pre>

<p>包括要搜索的关键词Keyword，图片的下载目录[DownloadDir]，还有要下载的页数[Pages]，默认为1，编码的第一步当然是要检查输入参数的，代码如下所示：</p>



<pre class="prettyprint"><code class=" hljs python"><span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">CheckArgs</span><span class="hljs-params">()</span>:</span>
    <span class="hljs-keyword">if</span>(len(sys.argv) &lt; <span class="hljs-number">3</span>):
        <span class="hljs-keyword">print</span> <span class="hljs-string">'Usage: python ImgSearch.py [Keyword] [DownloadDir] [Pages=1]'</span>;
        <span class="hljs-keyword">return</span> <span class="hljs-keyword">False</span>;
    <span class="hljs-keyword">return</span> <span class="hljs-keyword">True</span>;</code></pre>

<p>该段只检查了参数个数，因为第一个参数是脚本名字，所以如果参数小于3个，证明输入有误，并告知用户使用方法。 <br>
输入正常之后，就可以开始搜索图片了。</p>



<h2 id="图片搜索">图片搜索</h2>

<p>首先上代码</p>



<pre class="prettyprint"><code class=" hljs python"><span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">Search</span><span class="hljs-params">()</span>:</span>
    params = {
        <span class="hljs-string">'tn'</span> : <span class="hljs-string">'resultjsonavatarnew'</span>,
        <span class="hljs-string">'ie'</span> : <span class="hljs-string">'utf-8'</span>,
        <span class="hljs-string">'cg'</span> : <span class="hljs-string">''</span>,
        <span class="hljs-string">'itg'</span> : <span class="hljs-string">''</span>,
        <span class="hljs-string">'z'</span> : <span class="hljs-string">'0'</span>,
        <span class="hljs-string">'fr'</span> : <span class="hljs-string">''</span>,
        <span class="hljs-string">'width'</span> : <span class="hljs-string">''</span>,
        <span class="hljs-string">'height'</span> : <span class="hljs-string">''</span>,
        <span class="hljs-string">'lm'</span> : <span class="hljs-string">'-1'</span>,
        <span class="hljs-string">'ic'</span> : <span class="hljs-string">'0'</span>,
        <span class="hljs-string">'s'</span> : <span class="hljs-string">'0'</span>,
        <span class="hljs-string">'word'</span> : sys.argv[<span class="hljs-number">1</span>],
        <span class="hljs-string">'st'</span> : <span class="hljs-string">'-1'</span>,
        <span class="hljs-string">'gsm'</span> : <span class="hljs-string">''</span>,
        <span class="hljs-string">'rn'</span> : <span class="hljs-string">'30'</span>
        };

    <span class="hljs-keyword">if</span>(len(sys.argv) == <span class="hljs-number">4</span>):
        pages = int(sys.argv[<span class="hljs-number">3</span>]);
    <span class="hljs-keyword">else</span>:
        pages = <span class="hljs-number">1</span>;

    <span class="hljs-keyword">for</span> i <span class="hljs-keyword">in</span> range(<span class="hljs-number">0</span>, pages):
        params[<span class="hljs-string">'pn'</span>] = <span class="hljs-string">'%d'</span> % i;
        Request(params);
    <span class="hljs-keyword">return</span> ;</code></pre>

<p>其实都不懂百度图片中请求的参数的意思，不过经过验证，有一些参数是可以去掉的，有些能去掉的参数我也保留了。所以上述参数并不是需要全部传入。目前为止，pn参数代表的应该是页数，rn代表的应该是每页多少张图片，word参数自然是关键词，知道这些就足够了。之后就是发送请求，请求JSON数据了。</p>



<h2 id="请求数据">请求数据</h2>

<p>如代码所示：</p>



<pre class="prettyprint"><code class=" hljs python"><span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">Request</span><span class="hljs-params">(param)</span>:</span>
    searchurl = <span class="hljs-string">'http://image.baidu.com/search/avatarjson'</span>;
    response = requests.get(searchurl, params=param);
    json = response.json()[<span class="hljs-string">'imgs'</span>];

    <span class="hljs-keyword">for</span> i <span class="hljs-keyword">in</span> range(<span class="hljs-number">0</span>, len(json)):
        filename = os.path.split(json[i][<span class="hljs-string">'objURL'</span>])[<span class="hljs-number">1</span>];
        <span class="hljs-keyword">print</span> <span class="hljs-string">'Downloading from %s'</span> % json[i][<span class="hljs-string">'objURL'</span>];
        Download(json[i][<span class="hljs-string">'objURL'</span>], filename);

    <span class="hljs-keyword">return</span> ;</code></pre>

<p>使用requests库的好处就是，参数不需要连接在URL后面，只需要传入一个参数字典，并且可以使用json()方法，将返回的数据格式化到相应的数据结构中，请求到数据之后，分析JSON数据可知，其中的字段objURL，即表示了原图的下载地址。</p>



<h2 id="下载图片">下载图片</h2>

<pre class="prettyprint"><code class=" hljs python"><span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">Download</span><span class="hljs-params">(url, filename)</span>:</span>
    <span class="hljs-keyword">if</span>(os.path.exists(sys.argv[<span class="hljs-number">2</span>]) == <span class="hljs-keyword">False</span>):
        os.mkdir(sys.argv[<span class="hljs-number">2</span>]);
    filepath = os.path.join(sys.argv[<span class="hljs-number">2</span>], <span class="hljs-string">'%s'</span> % filename);
    urllib.urlretrieve(url, filepath);
    <span class="hljs-keyword">return</span> ;</code></pre>

<p>下载图片之前，首先要检查用户指定的下载目录存不存在，如果不存在，则需要创建目录，然后构建文件路径，使用os.path.join方法，连合两个路径，使用该方法，用户不需要添加路径分隔符。之后便可以使用urllib.urlretrieve方法下载图片了。</p>



<h2 id="结束">结束</h2>

<p>全部代码编写完成之后，我们便可以组织代码运行顺序，如下：</p>



<pre class="prettyprint"><code class=" hljs php"><span class="hljs-keyword">if</span> __name__ == <span class="hljs-string">'__main__'</span>:
    <span class="hljs-keyword">if</span>(CheckArgs() == <span class="hljs-keyword">False</span>):
        sys.<span class="hljs-keyword">exit</span>(-<span class="hljs-number">1</span>);
    Search();
    <span class="hljs-keyword">print</span> <span class="hljs-string">'Total Images:%d'</span> % file_count(sys.argv[<span class="hljs-number">2</span>]);</code></pre>

<p>若参数输入错误，则退出脚本，否则搜索关键词，并输出相应提示。</p>



<h1 id="效果演示">效果演示</h1>

<h2 id="脚本执行演示">脚本执行演示</h2>

<p><img src="http://img.blog.csdn.net/20161010103244357" alt="脚本执行演示" title=""></p>

<h2 id="结果演示">结果演示</h2>

<p><img src="http://img.blog.csdn.net/20161010103321976" alt="结果演示" title=""></p>



<h1 id="代码链接">代码链接</h1>

<p><a href="https://github.com/WangLuofan/Spider">爬虫代码</a></p>                            </div>
                                    <link rel="stylesheet" href="http://csdnimg.cn/release/phoenix/production/markdown_views-993eb3f29c.css" />
                                    </div>
    </article>
      <div class="readall_box csdn-tracking-statistics tracking-click" data-mod="popu_376">
          <div class="read_more_mask"></div>
          <a class="btn btn-large btn-gray-fred read_more_btn" target="_self">阅读全文</a>
      </div>
      <div class="article_copyright">
        版权声明：本文为博主原创文章，未经博主允许不得转载。      </div>
      <ul class="article_collect clearfix csdn-tracking-statistics tracking-click"  data-mod="popu_378">
          <li class="tit">本文已收录于以下专栏：</li>
<!--          [startarticlecolumns]-->
                                <!--          [endarticlecolumns]-->
      </ul>
      <div class="comment_box clearfix" id="comments">
          <div id="comment_form">
              <div id="commentsbmitarear">
                              </div>
          </div>
      </div>
      <div class="comment_li_outbox">
          <div id="comment_list"></div>
      </div>

      <div class="more_comment">
          <div id="comment_bar" class="trackgin-ad" data-mod="popu_385"></div>
      </div>

      <!-- <h3 class="recommend_tit" id="related">相关文章推荐</h3> -->
      <div class="recommend_list clearfix" id="rasss">
                                                                        <dl class="clearfix csdn-tracking-statistics recommend_article" data-mod="popu_387" data-poputype="feed"  data-feed-show="false"  data-dsm="post">
                      <a href="http://blog.csdn.net/qq_32166627/article/details/60882964"  target="_blank" strategy="BlogCommendFromBaidu_0">
                        <dd class="clearfix">
                          <h2 class="">python学习（7）：python爬虫之爬取动态加载的图片，以百度图片为例</h2>
                          <div class="summary">
                              前言：前面我们爬取图片的网站都是静态的，在页面中右键查看源码就能看到网页中图片的位置。这样我们用requests库得到页面源码后，再用bs4库解析标签即可保存图片到本地。当我们在看百度图片时，右键–检...                          </div>

                          <ul class="">
                              <li class="avatar_img"><img src="http://avatar.csdn.net/4/E/B/3_qq_32166627.jpg" alt="qq_32166627" title="qq_32166627"/></li>
                              <li class="user_name">qq_32166627</li>
                              <li class="time">2017年03月08日 21:35</li>
                              <li class="visited_num"><i class="icon iconfont icon-read"></i><span>6875</span></li>
                          </ul>
                        </dd>
                      </a>
                  </dl>
                                                                                      <dl class="clearfix csdn-tracking-statistics recommend_article" data-mod="popu_387" data-poputype="feed"  data-feed-show="false"  data-dsm="post">
                      <a href="http://blog.csdn.net/greatkendy123/article/details/51737576"  target="_blank" strategy="BlogCommendFromBaidu_1">
                        <dd class="clearfix">
                          <h2 class="">java爬取百度图片</h2>
                          <div class="summary">
                              公司智能分析部的一位同事遇到难题了，他正阵子做人脸识别，经理给他的图片来源都是外国图片，他想用中国的人脸来作测试，当然最好是中国明星，但是又嫌从百度上一张一张下载比较麻烦，于是找我帮个忙，看看能不能解...                          </div>

                          <ul class="">
                              <li class="avatar_img"><img src="http://avatar.csdn.net/0/6/F/3_greatkendy123.jpg" alt="greatkendy123" title="greatkendy123"/></li>
                              <li class="user_name">greatkendy123</li>
                              <li class="time">2016年06月22日 23:22</li>
                              <li class="visited_num"><i class="icon iconfont icon-read"></i><span>4376</span></li>
                          </ul>
                        </dd>
                      </a>
                  </dl>
                                                                      <dl class="">
                  <script>
                  (function() {
                    var s = "_" + Math.random().toString(36).slice(2);
                    document.write('<div id="' + s + '"></div>');
                    (window.slotbydup=window.slotbydup || []).push({
                      id: '4765209',
                      container: s,
                      size: '808,120',
                      display: 'inlay-fix'
                    });
                  })();
                  </script>
                </dl>
                                                                <dl class="clearfix csdn-tracking-statistics downloadElement" data-mod="popu_387" data-poputype="feed"  data-feed-show="false"  data-dsm="post">
                      <a class="clearfix" href="http://download.csdn.net/download/machong_mc/9817934" target="_blank" strategy="searchFromBaidu_2">
                        <dd class="floatL">
                            <div class="summary">
                                <h2>java爬虫爬取百度图片</h2>
                                <div class="summary">
                                    <ul>
                                        <li class="time">2017年04月18日 16:08</li>
                                        <li class="visited_num fileSize">544KB</li>
                                        <li class="download_btn">下载</li>
                                    </ul>
                                </div>
                            </div>
                        </dd>
                        <dt class="floatR"><img class="maxwidth" src="http://csdnimg.cn/release/download/old_static/images/minetype/zip.svg" alt="" title=""/></dt>
                      </a>
                  </dl>
                                                                                      <dl class="clearfix csdn-tracking-statistics recommend_article" data-mod="popu_387" data-poputype="feed"  data-feed-show="false"  data-dsm="post">
                      <a href="http://blog.csdn.net/MAILLIBIN/article/details/52244375"  target="_blank" strategy="searchFromBaidu_3">
                        <dd class="clearfix">
                          <h2 class="">PHP爬取百度图片</h2>
                          <div class="summary">
                                                        </div>

                          <ul class="">
                              <li class="avatar_img"><img src="http://avatar.csdn.net/0/1/F/3_maillibin.jpg" alt="MAILLIBIN" title="MAILLIBIN"/></li>
                              <li class="user_name">MAILLIBIN</li>
                              <li class="time">2016年08月18日 20:00</li>
                              <li class="visited_num"><i class="icon iconfont icon-read"></i><span>1370</span></li>
                          </ul>
                        </dd>
                      </a>
                  </dl>
                                                                                      <dl class="clearfix csdn-tracking-statistics recommend_article" data-mod="popu_387" data-poputype="feed"  data-feed-show="false"  data-dsm="post">
                      <a href="http://blog.csdn.net/qq_23228315/article/details/72667802"  target="_blank" strategy="BlogCommendFromBaidu_4">
                        <dd class="clearfix">
                          <h2 class="">Scrapy爬取百度图片（一）</h2>
                          <div class="summary">
                              Scrapy爬百度图片（一）本人小白一个，最近初学scrapy，所以边学边记录咯！Scrapy入门 
关于这部分我不能提供更多帮助哈哈哈！参考http://scrapy-chs.readthedocs...                          </div>

                          <ul class="">
                              <li class="avatar_img"><img src="http://avatar.csdn.net/9/B/1/3_qq_23228315.jpg" alt="qq_23228315" title="qq_23228315"/></li>
                              <li class="user_name">qq_23228315</li>
                              <li class="time">2017年05月23日 22:07</li>
                              <li class="visited_num"><i class="icon iconfont icon-read"></i><span>757</span></li>
                          </ul>
                        </dd>
                      </a>
                  </dl>
                                                                                      <dl class="clearfix csdn-tracking-statistics recommend_article" data-mod="popu_387" data-poputype="feed"  data-feed-show="false"  data-dsm="post">
                      <a href="http://blog.csdn.net/xiligey1/article/details/73321152"  target="_blank" strategy="BlogCommendFromBaidu_5">
                        <dd class="clearfix">
                          <h2 class="">Python爬取百度图片</h2>
                          <div class="summary">
                              新人上路, 老司机们请多多关照, 写的不好的地方, 还请多指教.





在很久很久以前, 我是一个苦逼的90后挨踢空穴老人, 一个人的夜里可是什么事都能干得出来! 这不, 我用我的把老师的图片给抓...                          </div>

                          <ul class="">
                              <li class="avatar_img"><img src="http://avatar.csdn.net/1/5/8/3_xiligey1.jpg" alt="xiligey1" title="xiligey1"/></li>
                              <li class="user_name">xiligey1</li>
                              <li class="time">2017年06月16日 08:59</li>
                              <li class="visited_num"><i class="icon iconfont icon-read"></i><span>1833</span></li>
                          </ul>
                        </dd>
                      </a>
                  </dl>
                                                                                      <dl class="clearfix csdn-tracking-statistics recommend_article" data-mod="popu_387" data-poputype="feed"  data-feed-show="false"  data-dsm="post">
                      <a href="http://blog.csdn.net/greatkendy123/article/details/51759040"  target="_blank" strategy="BlogCommendFromBaidu_6">
                        <dd class="clearfix">
                          <h2 class="">jsoup爬取百度瀑布流图片</h2>
                          <div class="summary">
                              是的，Java也可以做网络爬虫，不仅可以爬静态网页的图片，也可以爬动态网页的图片，比如采用Ajax技术进行异步加载的百度瀑布流。
      以前有写过用Java进行百度图片的抓取，但只能抓取到第一二...                          </div>

                          <ul class="">
                              <li class="avatar_img"><img src="http://avatar.csdn.net/0/6/F/3_greatkendy123.jpg" alt="greatkendy123" title="greatkendy123"/></li>
                              <li class="user_name">greatkendy123</li>
                              <li class="time">2016年06月25日 17:02</li>
                              <li class="visited_num"><i class="icon iconfont icon-read"></i><span>3407</span></li>
                          </ul>
                        </dd>
                      </a>
                  </dl>
                                                                                      <dl class="clearfix csdn-tracking-statistics downloadElement" data-mod="popu_387" data-poputype="feed"  data-feed-show="false"  data-dsm="post">
                      <a class="clearfix" href="http://download.csdn.net/download/young2415/9924014" target="_blank" strategy="BlogCommendFromBaidu_7">
                        <dd class="floatL">
                            <div class="summary">
                                <h2>Python3爬虫抓取百度图片中的图片</h2>
                                <div class="summary">
                                    <ul>
                                        <li class="time">2017年08月07日 21:58</li>
                                        <li class="visited_num fileSize">4KB</li>
                                        <li class="download_btn">下载</li>
                                    </ul>
                                </div>
                            </div>
                        </dd>
                        <dt class="floatR"><img class="maxwidth" src="http://csdnimg.cn/release/download/old_static/images/minetype/unkonw.svg" alt="" title=""/></dt>
                      </a>
                  </dl>
                                                                                      <dl class="clearfix csdn-tracking-statistics recommend_article" data-mod="popu_387" data-poputype="feed"  data-feed-show="false"  data-dsm="post">
                      <a href="http://blog.csdn.net/X_JS612/article/details/78149627"  target="_blank" strategy="BlogCommendFromBaidu_8">
                        <dd class="clearfix">
                          <h2 class="">python 3 爬取百度图片</h2>
                          <div class="summary">
                              纠结于爬取百度图片，竟然花费了一天的时间才让程序顺利跑起来。其中踩坑无数。而且还发现公司电脑实在是比较差劲。。。import requests
import urllib  
import os , ...                          </div>

                          <ul class="">
                              <li class="avatar_img"><img src="http://avatar.csdn.net/E/2/D/3_x_js612.jpg" alt="X_JS612" title="X_JS612"/></li>
                              <li class="user_name">X_JS612</li>
                              <li class="time">2017年10月02日 01:09</li>
                              <li class="visited_num"><i class="icon iconfont icon-read"></i><span>357</span></li>
                          </ul>
                        </dd>
                      </a>
                  </dl>
                                                                                      <dl class="clearfix csdn-tracking-statistics recommend_article" data-mod="popu_387" data-poputype="feed"  data-feed-show="false"  data-dsm="post">
                      <a href="http://blog.csdn.net/chencaw/article/details/78410187"  target="_blank" strategy="BlogCommendFromBaidu_9">
                        <dd class="clearfix">
                          <h2 class="">python3抓取百度图片</h2>
                          <div class="summary">
                              转载于
http://www.cnblogs.com/one-lightyear/p/python_crawl_image_baidu.html


##author:wuhao##爬取指定页...                          </div>

                          <ul class="">
                              <li class="avatar_img"><img src="http://avatar.csdn.net/D/6/8/3_chencaw.jpg" alt="chencaw" title="chencaw"/></li>
                              <li class="user_name">chencaw</li>
                              <li class="time">2017年11月01日 09:01</li>
                              <li class="visited_num"><i class="icon iconfont icon-read"></i><span>266</span></li>
                          </ul>
                        </dd>
                      </a>
                  </dl>
                                                    <!-- <script async="async" charset="utf-8" src="https://shared.ydstatic.com/js/yatdk/3.0.0/stream.js" data-notify="bannerMulti_notify" data-insert-nodes="yd_a_d_feed_1,yd_a_d_feed_13,yd_a_d_feed_18,yd_a_d_feed_23,yd_a_d_feed_28,yd_a_d_feed_33" data-id="8935aa488dd58452b9e5ee3b44f1212f" data-hide-ad-label="0" data-div-Style="width:100%;padding:16px 35px 16px 10px;" data-img-Style="float:right;width:120px;" data-tit-Style="font-size:20px;font-weight:bold;margin-bottom:10px;font-family: 'PingFang SC', 'Microsoft YaHei', SimHei, Arial, SimSun;" data-des-Style="width:700px;font-size:14px;font-family: 'PingFang SC', 'Microsoft YaHei', SimHei, Arial, SimSun;" > </script> -->
      
      </div>
  </main>
<aside>
    <div class="right_box user_info">
    <dl class="inf_bar clearfix">
        <dt class="csdn-tracking-statistics tracking-click" data-mod="popu_381">
        <a href="http://blog.csdn.net/cairo123" target="_blank">
            <img src="http://avatar.csdn.net/2/D/7/3_cairo123.jpg" class="avatar_pic">
        </a>
      </dt><dd>
            <h3 class="csdn-tracking-statistics tracking-click"  data-mod="popu_380"><a href="http://blog.csdn.net/cairo123" target="_blank" id="uid">cairo123</a></h3>
            <div class="medals" title="">
                      </div>
                        <span  class="csdn-tracking-statistics tracking-click" data-mod="popu_379"><a class="btn btn-redborder-small "  id="span_add_follow" target="_self">关注</a></span>
                    </dd>
    </dl>
    <div class="inf_number_box clearfix">
        <dl title="57">
            <dt>原创</dt>
            <dd>57</dd>
        </dl>
        <dl title="13">
            <dt>粉丝</dt>
            <dd id='fan'>13</dd>
        </dl>
        <dl title="1">
            <dt>喜欢</dt>
            <dd>1</dd>
        </dl>
        <dl title="54">
          <dt>评论</dt>
          <dd>54</dd>
        </dl>
    </div>

</div>
<div class="interflow clearfix">
      <div class="badge gradeAndbadge">
        <div>
                                    <img src='http://c.csdnimg.cn/jifen/images/xunzhang/xunzhang/chizhiyiheng.png' alt='持之以恒'>
                                            </div>
    </div>
      <div class="grade gradeAndbadge">
      <span>等级：</span>
      <div>
        <a href="http://blog.csdn.net/home/help.html#level" title="4级,点击查看等级说明" target="_blank">
          <img class="grade-img" src="http://c.csdnimg.cn/jifen/images/xunzhang/jianzhang/blog4.png" alt="4级,点击查看等级说明">
        </a>
      </div>
    </div>
    <div class="gradeAndbadge" title="58027">
        <span>访问量：</span>
        <span class="num odd-overhidden">58.02K</span>
    </div>

    <div class="gradeAndbadge" title="1169">
      <span>积分：</span>
      <span  class="num odd-overhidden">1.16K</span>
    </div>
    <div class="gradeAndbadge" title="41294">
        <span>排名：</span>
        <span class="num odd-overhidden">41.29K</span>
    </div>

</div>          <div class="extension_other csdn-tracking-statistics tracking-click" data-mod="popu_389">
          <!--u3032528-->
        <div class="flashrecommend">
            <script type="text/javascript" src="//cee1.iteye.com/bwocoltly.js"></script>
        </div>
      </div>
      <div class="writings">
    <div class="public_signal clearfix">
      <h3>他的最新文章</h3>
      <a href="http://blog.csdn.net/cairo123" target="_blank" class="more"><span>更多文章</span></a>
    </div>
      <ul class="inf_list clearfix csdn-tracking-statistics tracking-click" data-mod="popu_382">
                    <li class="clearfix">
              <a href="http://blog.csdn.net/cairo123/article/details/78808763" target="_blank">iOS编译libx264+libfdk-aac+FFmpeg</a>
          </li>
                    <li class="clearfix">
              <a href="http://blog.csdn.net/cairo123/article/details/78780407" target="_blank">使用FFmpeg+SDL打开Mac摄像头</a>
          </li>
                    <li class="clearfix">
              <a href="http://blog.csdn.net/cairo123/article/details/78615901" target="_blank">使用PDFKit写一个基本的PDF阅读器</a>
          </li>
                    <li class="clearfix">
              <a href="http://blog.csdn.net/cairo123/article/details/77986611" target="_blank">AVFoundation学习笔记(四): 媒体的创建与编辑</a>
          </li>
                    <li class="clearfix">
              <a href="http://blog.csdn.net/cairo123/article/details/77871610" target="_blank">AVFoundation学习笔记(三): 媒体捕捉、读取及写入</a>
          </li>
                </ul>
  </div>
            <div class="user-hotArticle sort userSort">
            <h3>文章分类</h3>
            <ul class="hotArticle-list userSort-list">
                                    <li class="clearfix">
                        <a href="http://blog.csdn.net/cairo123/article/category/6053854" class="odd-overhidden floatL">iOS开发</a>
                        <div class="read list-left floatR"><span>32篇</span></div>
                    </li>
                                    <li class="clearfix">
                        <a href="http://blog.csdn.net/cairo123/article/category/6509586" class="odd-overhidden floatL">TCP/IP详解</a>
                        <div class="read list-left floatR"><span>10篇</span></div>
                    </li>
                                    <li class="clearfix">
                        <a href="http://blog.csdn.net/cairo123/article/category/6335322" class="odd-overhidden floatL">C/C++</a>
                        <div class="read list-left floatR"><span>11篇</span></div>
                    </li>
                                    <li class="clearfix">
                        <a href="http://blog.csdn.net/cairo123/article/category/6454517" class="odd-overhidden floatL">Python</a>
                        <div class="read list-left floatR"><span>3篇</span></div>
                    </li>
                                    <li class="clearfix">
                        <a href="http://blog.csdn.net/cairo123/article/category/6053864" class="odd-overhidden floatL">杂谈</a>
                        <div class="read list-left floatR"><span>1篇</span></div>
                    </li>
                                    <li class="clearfix">
                        <a href="http://blog.csdn.net/cairo123/article/category/6806050" class="odd-overhidden floatL">javaweb</a>
                        <div class="read list-left floatR"><span>2篇</span></div>
                    </li>
                            </ul>
            <div class="unfold-btn">
              <span>展开</span><i class="icon iconfont icon-xiajiantou"></i>
            </div>
        </div>
    <!--    [StartShowSelfColumn]-->
    <!--    [EndShowSelfColumn]-->
            <div class="user-hotArticle sort timeSort">
          <h3>文章存档</h3>
          <ul class="hotArticle-list timeSort-list">
                            <li class="clearfix">
                  <a href="http://blog.csdn.net/cairo123/article/month/2017/12" class="odd-overhidden floatL">2017年12月</a>
                  <div class="read list-left floatR"><span>2篇</span></div>
                </li>
                            <li class="clearfix">
                  <a href="http://blog.csdn.net/cairo123/article/month/2017/11" class="odd-overhidden floatL">2017年11月</a>
                  <div class="read list-left floatR"><span>1篇</span></div>
                </li>
                            <li class="clearfix">
                  <a href="http://blog.csdn.net/cairo123/article/month/2017/09" class="odd-overhidden floatL">2017年9月</a>
                  <div class="read list-left floatR"><span>4篇</span></div>
                </li>
                            <li class="clearfix">
                  <a href="http://blog.csdn.net/cairo123/article/month/2017/06" class="odd-overhidden floatL">2017年6月</a>
                  <div class="read list-left floatR"><span>2篇</span></div>
                </li>
                            <li class="clearfix">
                  <a href="http://blog.csdn.net/cairo123/article/month/2017/05" class="odd-overhidden floatL">2017年5月</a>
                  <div class="read list-left floatR"><span>5篇</span></div>
                </li>
                            <li class="clearfix">
                  <a href="http://blog.csdn.net/cairo123/article/month/2017/04" class="odd-overhidden floatL">2017年4月</a>
                  <div class="read list-left floatR"><span>5篇</span></div>
                </li>
                            <li class="clearfix">
                  <a href="http://blog.csdn.net/cairo123/article/month/2017/03" class="odd-overhidden floatL">2017年3月</a>
                  <div class="read list-left floatR"><span>4篇</span></div>
                </li>
                            <li class="clearfix">
                  <a href="http://blog.csdn.net/cairo123/article/month/2017/01" class="odd-overhidden floatL">2017年1月</a>
                  <div class="read list-left floatR"><span>2篇</span></div>
                </li>
                            <li class="clearfix">
                  <a href="http://blog.csdn.net/cairo123/article/month/2016/12" class="odd-overhidden floatL">2016年12月</a>
                  <div class="read list-left floatR"><span>7篇</span></div>
                </li>
                            <li class="clearfix">
                  <a href="http://blog.csdn.net/cairo123/article/month/2016/11" class="odd-overhidden floatL">2016年11月</a>
                  <div class="read list-left floatR"><span>7篇</span></div>
                </li>
                            <li class="clearfix">
                  <a href="http://blog.csdn.net/cairo123/article/month/2016/10" class="odd-overhidden floatL">2016年10月</a>
                  <div class="read list-left floatR"><span>3篇</span></div>
                </li>
                            <li class="clearfix">
                  <a href="http://blog.csdn.net/cairo123/article/month/2016/09" class="odd-overhidden floatL">2016年9月</a>
                  <div class="read list-left floatR"><span>2篇</span></div>
                </li>
                            <li class="clearfix">
                  <a href="http://blog.csdn.net/cairo123/article/month/2016/08" class="odd-overhidden floatL">2016年8月</a>
                  <div class="read list-left floatR"><span>1篇</span></div>
                </li>
                            <li class="clearfix">
                  <a href="http://blog.csdn.net/cairo123/article/month/2016/07" class="odd-overhidden floatL">2016年7月</a>
                  <div class="read list-left floatR"><span>3篇</span></div>
                </li>
                            <li class="clearfix">
                  <a href="http://blog.csdn.net/cairo123/article/month/2016/05" class="odd-overhidden floatL">2016年5月</a>
                  <div class="read list-left floatR"><span>1篇</span></div>
                </li>
                            <li class="clearfix">
                  <a href="http://blog.csdn.net/cairo123/article/month/2016/03" class="odd-overhidden floatL">2016年3月</a>
                  <div class="read list-left floatR"><span>4篇</span></div>
                </li>
                            <li class="clearfix">
                  <a href="http://blog.csdn.net/cairo123/article/month/2016/02" class="odd-overhidden floatL">2016年2月</a>
                  <div class="read list-left floatR"><span>1篇</span></div>
                </li>
                            <li class="clearfix">
                  <a href="http://blog.csdn.net/cairo123/article/month/2016/01" class="odd-overhidden floatL">2016年1月</a>
                  <div class="read list-left floatR"><span>4篇</span></div>
                </li>
                      </ul>
          <div class="unfold-btn">
            <span>展开</span><i class="icon iconfont icon-xiajiantou"></i>
          </div>
        </div>
        <div class="user-hotArticle">
        <h3>他的热门文章</h3>
        <ul class="hotArticle-list csdn-tracking-statistics tracking-click" data-mod="popu_521">
<!--            [StartHotArticles]-->
                                                <li>
                        <a href="http://blog.csdn.net/cairo123/article/details/52054280">Mac OS X 使用gdb</a>
                        <div class="read list-left"><i class="icon iconfont icon-read"></i><span>8679</span></div>
                    </li>
                                    <li>
                        <a href="http://blog.csdn.net/cairo123/article/details/52775420">百度图片小爬虫</a>
                        <div class="read list-left"><i class="icon iconfont icon-read"></i><span>4612</span></div>
                    </li>
                                    <li>
                        <a href="http://blog.csdn.net/cairo123/article/details/65629216">配置Struts-2.5.10</a>
                        <div class="read list-left"><i class="icon iconfont icon-read"></i><span>4284</span></div>
                    </li>
                                    <li>
                        <a href="http://blog.csdn.net/cairo123/article/details/53839980">iOS音频播放之AudioQueue(一)：播放本地音乐</a>
                        <div class="read list-left"><i class="icon iconfont icon-read"></i><span>4049</span></div>
                    </li>
                                    <li>
                        <a href="http://blog.csdn.net/cairo123/article/details/52262017">自定义UICollectionView布局</a>
                        <div class="read list-left"><i class="icon iconfont icon-read"></i><span>3287</span></div>
                    </li>
                            <!--            [EndHotArticles]-->
        </ul>
    </div>

<!--    [startcustom]-->
    <!--    [endcustom]-->
  <div class="fixRight_box" style="height:256px">
    <div class="fixRight">
                    <!--u3163270-->
            <script type="text/javascript" src="//cee1.iteye.com/avneunkwb.js"></script>
                <div class="right_box copyright csdn-tracking-statistics" data-mod="popu_475" data-dsm="post">
        <h3 class="feed_new_tit"><span class="line"></span><span class="txt">联系我们</span></h3>
        <div class="contact-box">
            <div class="img-box">
                <img src="https://www.csdn.net/images/csdn_cs_qr.png" alt="客服">
            </div>
            <div class="contact-info">
                <h4>请扫描二维码联系客服</h4>
                <p>
                    <i class="icon iconfont icon-mail"></i>
                    <a href="mailto:webmaster@csdn.net" target="_blank">
                        <span class="txt">webmaster@csdn.net</span>
                    </a>
                </p>
                <p>
                    <i class="icon iconfont icon-call"></i>
                    <span class="txt">400-660-0108</span>
                </p>
                <p>
                    <i class="icon iconfont icon-QQ"></i>
                    <a href="http://wpa.qq.com/msgrd?v=3&amp;uin=2431299880&amp;site=qq&amp;menu=yes" target="_blank">
                        <span class="txt">网站客服</span>
                    </a>
                </p>
            </div>
        </div>
        <div class="bg-gray">
            <div class="feed_copyright">
                <p><a class="right-dotte" href="//www.csdn.net/company/about.html" target="_blank">关于</a><a href="//www.csdn.net/company/recruit.html" target="_blank" class="right-dotte">招聘</a><a href="//www.csdn.net/company/marketing.html" target="_blank" class="right-dotte">广告服务</a><img src="https://www.csdn.net/images/ali01.png" alt="ali" title="ali"></p>
                <p class="fz12">©2018 CSDN <a href="http://www.miibeian.gov.cn/" target="_blank" class="ml14">京ICP证09002463号</a></p>
            </div>
            <div class="allow-info-box">
                <p><a href="http://www.hd315.gov.cn/beian/view.asp?bianhao=010202001032100010" target="_blank"><span>经营性网站备案信息</span></a></p>
                <p><a href="http://www.cyberpolice.cn/" target="_blank"><span>网络110报警服务</span></a></p>
                <p><a href="http://www.12377.cn/" target="_blank"><span>中国互联网举报中心</span></a></p>
                <p><a href="http://www.bjjubao.org/" target="_blank"><span>北京互联网违法和不良信息举报中心</span></a></p>
            </div>
        </div>
    </div>
    </div>
  </div>
</aside></div>

<div class="left_fixed">
    <div class="left_show_button">
        <span>
          <i class="icon iconfont icon-youjiantou"></i>
        </span>
    </div>
    <ul class="left_menu" id="share_box">
        <li>
            <button class="left-fixed-btn btn-like csdn-tracking-statistics tracking-click" data-mod="popu_373" target="_self" title="点赞">
                <a href="javascript:void(0);" class="iconbox border_red" ><i class="icon iconfont icon-dianzan"></i></a>
                <a class="txt" href="javascript:void(0);">1</a>
            </button>
        </li>
        <li id="blog_artical_directory">
            <button class="left-fixed-btn left_menu_btn csdn-tracking-statistics tracking-click" data-mod="popu_372" target="_self" title="目录">
                <a href="javascript:void(0);" class="iconbox border_black" ><i class="icon iconfont icon-mulu"></i></a>
            </button>
        </li>
        <li class="menu_con">
            <div class="list_father">
                <div class="arr_box">
                    <button class="btn-noborder arr-btn scroll-down  left_scroll_down"><i class="icon iconfont icon-xiajiantou"></i></button>
                    <button class="btn-noborder arr-btn scroll-up left_scroll_top"><i class="icon iconfont icon-shangjiantou"></i></button>
                </div>
                <div class="arr"></div>
                <div id="csdnBlogDir"></div>
            </div>
        </li>
        <!--        <li>-->
        <!--            <button class="left-fixed-btn btn-like tracking-ad" data-mod="popu_373" target="_self">-->
        <!--                <span class="iconbox border_red"><i class="icon iconfont icon-xihuan-"></i></span>-->
        <!--                <span class="txt">喜欢</span>-->
        <!--                <span class="untxt">取消喜欢</span>-->
        <!--            </button>-->
        <!--        </li>-->
        <li>
            <button class="left-fixed-btn csdn-tracking-statistics tracking-click" data-mod="popu_374"  id="com-quick-collect" target="_self" title="收藏">
                <a href="javascript:void(0);" class="iconbox border_purple" ><i class="icon iconfont icon-shoucang"></i></a>
            </button>
        </li>
        <li>
            <button class="left-fixed-btn btn-pinglun csdn-tracking-statistics tracking-click" data-mod="popu_544" title="评论">
                <a href="javascript:void(0);" class="iconbox border_purple" ><i class="icon iconfont icon-pinglun"></i></a>
            </button>
        </li>
        <li class="bdsharebuttonbox">
          <button class="outside left-fixed-btn csdn-tracking-statistics tracking-click" data-mod="popu_172" title="分享到新浪微博">
                <span class="iconbox border_red2"><i class="icon iconfont icon-xinlang"></i></span>
                <a href="#" class="bds_tsina" data-cmd="tsina" > </a>
          </button>
        </li>
        <li class="bdsharebuttonbox">
          <button class="outside left-fixed-btn csdn-tracking-statistics tracking-click" data-mod="popu_172" title="分享到微信">
              <span class="iconbox border_green"><i class="icon iconfont icon-weixin"></i></span>
              <a href="#" class="bds_weixin" data-cmd="weixin" > </a>
          </button>
        </li>
        <li class="bdsharebuttonbox">
          <button class="outside left-fixed-btn csdn-tracking-statistics tracking-click" data-mod="popu_172" title="分享到QQ空间">
              <span class="iconbox border_blue"><i class="icon iconfont icon-QQ"></i></span>
              <a href="#" class="bds_qzone" data-cmd="qzone" > </a>
          </button>
        </li>
        <li id="share_box">
            
            <div class="bdsharebuttonbox csdn-tracking-statistics tracking-click" data-mod="popu_172">
                
                
                
            </div>
        </li>
    </ul>
</div>
<div class="right_fixed">
    <div class="r_ico">
        <i class="icon iconfont icon-jubao"></i>
        <span class="txt" id="reportBtn">内容举报</span>
    </div>
    <div class="returnTop">
        <i class="icon iconfont icon-fanhuidingbu"></i>
        <span>返回顶部</span>
    </div>
</div>
<div id="pop_win"></div>
<div id="popup_mask"></div>
<div class="pop_CA_cover" ></div>
<div class="pop pop_CA" >
    <div class="CA_header">
        收藏助手
        <span class="cancel_icon"  id="fapancle" ></span>
    </div>
    <iframe src="" id="collectIframe" frameborder="0" width="100%" height="360"  scrolling="no" ></iframe>
</div>
<!--举报-->
<div id="report_dialog" style="top: 250px; left: 343.5px;"><div id="panel_report">
    <div class="panel_head">不良信息举报</div>
    <form method="post" id="frmReport" class="panel_body">
        <table border="0" cellpadding="0" cellspacing="4" class="pop_table">
            <tbody><tr><td colspan="2">您举报文章：<a href="http://blog.csdn.net/cairo123/article/details/52775420" target="_blank">百度图片小爬虫</a></td></tr>
            <tr>
                <th style="width:60px;">举报原因：</th>
                <td id="panel_reporttype">
                    <label><input type="radio" class="report_type" id="report_sex" name="report_type" value="1">色情</label>
                    <label><input type="radio" class="report_type" id="report_Politics" name="report_type" value="2">政治</label>
                    <label><input type="radio" class="report_type" id="report_copy" name="report_type" value="3">抄袭</label>
                    <label><input type="radio" class="report_type" id="report_ad" name="report_type" value="4">广告</label>
                    <label><input type="radio" class="report_type" id="report_want" name="report_type" value="5">招聘</label>
                    <label><input type="radio" class="report_type" id="report_call" name="report_type" value="6">骂人</label>
                    <br>
                    <label><input type="radio" class="report_type" id="report_other" name="report_type" value="7">其他</label>
                    <input type="text" name="report_other_content" id="report_other_content" maxlength="30" style="display: none;">
                </td>
            </tr>
            <tr id="panel_originalurl" style="display: none;">
                <th>原文地址：</th>
                <td>
                    <input id="originalurl" value="http://" name="originalurl" type="text" style="width: 90%;">
                </td>
            </tr>
            <tr>
                <th id="sp_reason">原因补充：</th>
                <td>
                    <textarea id="report_description" style="width: 300px;" rows="3" name="report_description"></textarea>
                    <p id="sp_n" style="color:#999;margin:0px;padding:0px;">(最多只允许输入30个字)</p>
                </td>
            </tr>
            <tr>
                <td></td>
                <td>
                    <input id="btnSubmitReport" name="submit" type="image" align="middle" class="btn_1" src="http://csdnimg.cn/release/phoenix/images/btn_submit.jpg">
                    <span style="padding-left:20px;"></span>
                    <img id="btnCloseReportDialog" src="http://csdnimg.cn/release/phoenix/images/btn_cancel.jpg" align="middle">
                    <div id="error" style="color: Red">
                    </div>
                </td>
            </tr>
            </tbody></table>
    </form>
</div>
    <script language="javascript" type="text/javascript">
        var isComment=0;
        //显示隐藏地址
        $(function () {
          console.log("version:phoenix");
            if(isComment){
                $("#report_description").attr("disabled",true);
                $("#sp_n").hide();
                $("#sp_reason").html("评论内容：");
            }
            $(".report_type").click(function () {
                $("#panel_originalurl,#report_other_content").hide();
                switch ($(this).val()) {
                    case '3':
                        $("#panel_originalurl").show();
                        $("#originalurl").focus();
                        break;
                    case '7':
                        if(isComment){
                            $("#report_other_content").show().focus();
                        }
                        break;
                }

            });

            $("#frmReport").submit(function () {
                if (!currentUserName) {

                    if (confirm("您的操作必须登录，是否登录？")) {
                        location.href = "http://passport.csdn.net/account/login?from=" + encodeURIComponent(location.href);
                        return false;
                    }
                    return false;
                }

                var reportType = $("input[name=report_type]:checked").val();
                if(!reportType){
                    alert("请选择举报原因！");
                    return false;
                }
                var otherInfo = "";
                switch (reportType) {
                    case '3':
                        otherInfo = $("#originalurl").val();
                        if (otherInfo == ""||otherInfo=="http://") {
                            alert("举报抄袭必须提供原创文章地址！");
                            $("#originalurl").focus();
                            return false;
                        } else if(!checkeURL(otherInfo)) {
                            alert("请输入正确的原创文章地址！");
                            $("#originalurl").focus();
                            return false;
                        }
                        break;
                    case '7':
                        otherInfo = $("#report_other_content").val();
                        if (isComment && !otherInfo) {
                            alert("请填写举报的具体原因！");
                            $("#report_other_content").focus();
                            return false;
                        }
                        if(!isComment){
                            if(!$("#report_description").val()){
                                alert("请填写举报的具体原因！");
                                $("#report_description").focus();
                                return false;
                            }
                        }
                        break;
                }
                if(!isComment){
                    if($("#report_description").val().length>30){
                        alert("举报原因最多只允许输入30个字！");
                        return false;
                    }
                }
	            nowTime = {
		            year: new Date().getFullYear(),
		            month: parseInt(new Date().getMonth())+1,
		            day: new Date().getDate(),
		            hours: parseInt(new Date().getHours())+1,
		            minutes: parseInt(new Date().getMinutes())+1,
		            seconds: parseInt(new Date().getSeconds())+1
	            };
	            var data = {
		            articleId: fileName,
		            commentId: 0,
		            reportType: reportType,
		            originalurl: $("#originalurl").val(),
		            report_other_content: $("#report_other_content").val(),
		            report_description: $("#report_description").val(),
		            currentUserName: currentUserName,
		            updatetime: nowTime.year+'/'+nowTime.month+'/'+nowTime.day+' '+ nowTime.hours+':'+nowTime.minutes+':'+seconds,
		            blogUser: username
	            };
	            if(!isComment){//如果是举报文章
		            data.report_other_content = data.report_description;
		            // data.report_description = "1. 神经网络这是一个常见的神经网络的图：这是一个常见的三层神经网络的基本构成，Layer L1是输入层，Layer L2是隐含层";
	            }

	            $.post(blog_address + "/common/report?id="+fileName+"&t=2", data, function (data) {
		            if (data.result == 1){
			            SetError("感谢您的举报，我们会尽快审核！");
		            }else{
			            if (data.content) alert(data.content);
		            }

	            });
                return false;
            });

            $("#btnCloseReportDialog").click(function () {
                CloseDiv();
            });

        });

        //提示后关闭方法
        function SetError(error) {
            $("#btnCloseReportDialog").trigger("click");
            alert(error);
            CloseDiv();
        }

        //关闭方法
        function CloseDiv() {

            $.removeMask();
            $("#report_dialog").hide();
            return false;
        }

        //验证url
        function checkeURL(url){
            return /^http(s)?:\/\/([\w-]+\.)+[\w-]+/i.test(url);
        }
    </script>
</div>
<!--  fixme 后期清理掉  -->
<div id="a52b5334d" style="width: 1px; height: 1px; display: none;">
    <script id="adJs52b5334"></script>
    <script>document.getElementById("adJs52b5334").src = "http://ads.csdn.net/js/opt/52b5334.js?t=" + Math.random();</script>
</div>
<!-- <script type="text/javascript" src="http://passport.csdn.net/content/loginbox/login.js"></script> -->
<script>window._bd_share_config = { "common": { "bdSnsKey": {}, "bdText": "", "bdMini": "1", "bdMiniList": false, "bdPic": "", "bdStyle": "0", "bdSize": "16" }, "share": {} }; with (document) 0[(getElementsByTagName('head')[0] || body).appendChild(createElement('script')).src = 'http://bdimg.share.baidu.com/static/api/js/share.js?v=89860593.js?cdnversion=' + ~(-new Date() / 36e5)];</script>
<script type="text/javascript" >
    if($(".article_collect li").length==1){$(".article_collect").hide();}
    if($(".article_tags li").length==1){$(".article_tags").hide();}
    $(".edit a").attr("href","http://mp.blog.csdn.net/postedit/"+fileName);
    $.each($(".edu_li a"),function(){$(this).attr("href",$(this).attr("href").replace("blog7","blog9"))});
    new CNick('#uid').showNickname();

    if($("#fan").html()=="")
    {
	    $("#fan").html(0);
    }
</script>
<script src="http://c.csdnimg.cn/public/common/append_mark/appendMark.min.js?v=5.00.43" type="text/javascript"></script>
<script type="text/javascript">
    appendMark($('.recommend_list').children('a').find('dt'),$('.extension_other'),$('.yd_a_d_feed_cla'))
</script>
<div class=""id="loginWrap"></div>
<div class="" id="dlMask"></div>
</body>
